/* Fonts for the demo */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 700;
  src: url(/inter-latin-ext-700-normal.woff) format('woff2');
}

/* UI */

@font-face {
  font-family: 'iaw-mono-var';
  font-weight: 100 700;
  font-style: normal;
  font-named-instance: 'Regular';
  font-display: block;
  src: url('/iaw-mono-var.woff2') format('woff2');
}

:root {
  --font: iaw-mono-var, SF Mono, SFMono-Regular, ui-monospace, Menlo, Consolas,
    monospace;
}

* {
  box-sizing: border-box;
}

html,
body,
#__next {
  height: 100%;
}

body {
  font-family: var(--font);
  font-variant: common-ligatures contextual;
  letter-spacing: -0.015em;
  margin: 0;
  background: fixed 0 0 /20px 20px radial-gradient(#d1d1d1 1px, transparent 0),
    fixed 10px 10px /20px 20px radial-gradient(#d1d1d1 1px, transparent 0);
  --border: 1px solid #d7d7d7;
  --border-inactive: 1px solid #e4e4e4;
}

nav {
  display: flex;
  position: sticky;
  top: 0;
  height: 40px;
  align-items: center;
  padding: 0 15px;
  background: white;
  box-shadow: 0 0 24px rgb(0 0 0 / 10%), 0 0 0 1px rgb(0 0 0 / 4%);
  font-size: 0.9rem;
  z-index: 2;
}

h1 {
  flex: 1;
  margin: 0;
  font-size: 0.9rem;
  font-weight: 500;
  color: #444;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  letter-spacing: -0.015rem;
  word-spacing: -0.09rem;
  cursor: default;
}

nav ul {
  display: flex;
  list-style: none;
  margin: 0;
  gap: 10px;
  padding: 0;
}

a {
  color: inherit;
}

iframe {
  position: absolute;
  border: none;
  appearance: none;
}

textarea,
pre,
code {
  font-family: var(--font) !important;
}
.editor {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: white;
  border-radius: 12px;
  border-top-left-radius: 0;
  border: var(--border);
  overflow: auto;
}
.editor .editor-controls {
  padding: 4px 8px;
  gap: 8px;
  display: flex;
  justify-content: flex-end;
}
.editor .editor-controls button {
  font-family: var(--font);
  font-size: 12px;
  user-select: none;
  padding: 0px 4px;
  height: 20px;
}
.editor .monaco-container {
  flex: 1;
}

.container {
  display: flex;
  width: 100%;
  height: calc(100% - 40px);
  margin: 0;
  padding: 10px;
  overflow: auto;
  gap: 10px;
}

.content-wrapper svg {
  width: 100%;
  height: 100%;
}

.tabs {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
}

.container > .tabs {
  height: 100%;
  display: flex;
  flex-direction: column;
  flex: 1 1 50%;
  max-width: 50%;
}

.preview {
  flex: 1 1 50%;
  max-width: calc(50% - 5px);
  align-self: flex-start;
}

.result-container {
  position: relative;
  display: flex;
  height: 100%;
  width: 100%;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.preview-card {
  flex: 1;
  position: relative;
  border-radius: 12px;
  border-top-left-radius: 0;
  background: #111;
  border: var(--border);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.preview-card footer {
  font-size: 12px;
  display: flex;
  align-items: center;
  padding: 3px 10px 4px;
  height: 24px;
  color: #444;
  border-top: 1px solid rgb(0 0 0 / 8%);
  background: #fafafa;
  white-space: nowrap;
}
.preview-card footer .ellipsis {
  white-space: pre;
  overflow: hidden;
  text-overflow: ellipsis;
}
.preview-card footer .data {
  flex: 1;
}

.error {
  position: absolute;
  width: 100%;
  height: calc(100% - 24px);
  padding: 10px 20px;
  overflow: auto;
  color: #ff3737;
  font-size: 13px;
  z-index: 1;
  background: white;
}
.error pre {
  margin: 0;
  white-space: pre-wrap;
}

.preview {
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tabs-container {
  display: inline-flex;
  position: relative;
  font-size: 12px;
  margin-bottom: -1px;
  letter-spacing: -0.02em;
  z-index: 1;
  user-select: none;
  white-space: nowrap;
  max-width: calc(100% - 15px);
}

.tab {
  color: #a5a5a5;
  background: #efefef;
  height: 22px;
  border-top-left-radius: 6px;
  border-top-right-radius: 6px;
  border: var(--border-inactive);
  border-bottom: var(--border);
  padding: 2px 10px 4px;
  cursor: default;
  text-overflow: ellipsis;
  overflow: hidden;
}
.tab:hover {
  background: #fafafa;
}

.tab.active {
  color: #111;
  font-weight: 600;
  border: var(--border);
  border-bottom: none;
  background: white;
}

.controller {
  flex: 1;
  height: 100%;
  border-radius: 12px;
  background: white;
  border: var(--border);
  overflow: hidden;
}

.controller h2.title {
  font-size: 12px;
  letter-spacing: -0.02em;
  font-weight: 500;
  color: #444;
  margin: 0;
  padding: 8px 10px;
  text-transform: uppercase;
  background: #fafafa;
  border-bottom: 1px solid rgb(0 0 0 / 8%);
  user-select: none;
}
.controller .content {
  display: flex;
  padding: 8px 10px;
  height: calc(100% - 34px);
  overflow: auto;
  flex-direction: column;
}
.controller .control {
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.controller .control > div {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}
.controller .control:not(:last-child) {
  padding-bottom: 8px;
  margin-bottom: 8px;
  border-bottom: 1px solid rgb(0 0 0 / 8%);
}
.controller .control label {
  flex: 0 0 140px;
  user-select: none;
}
.controller input {
  font-family: var(--font);
  outline: none;
}
.controller input[type='number'] {
  appearance: none;
  border: 1px solid rgb(0 0 0 / 20%);
  border-radius: 4px;
}
.controller input[type='number']:hover {
  border: 1px solid rgb(0 0 0 / 30%);
}
.controller input[type='number']:focus {
  border: 1px solid rgb(0 0 0 / 40%);
}
.controller a.disabled {
  color: #a5a5a5;
  cursor: not-allowed;
}
.controller .copyright {
  flex: 1;
}

@media screen and (max-width: 999px) {
  .container {
    flex-direction: column-reverse;
  }
  .preview {
    height: unset;
    width: 100%;
    max-height: calc((50vw - 15px) * 9 / 16 + 44px);
    max-width: 100%;
    flex-direction: row;
  }
  .container > .tabs {
    max-width: unset;
    max-height: calc(100% - (50vw - 15px) * 9 / 16 - 54px);
  }
  .preview > .tabs {
    width: calc(50% - 5px);
  }
  .controller .control label {
    flex: 0 0 120px;
  }
}

@media screen and (max-width: 599px) {
  .preview > .tabs,
  .controller {
    width: 100%;
  }
  .container {
    gap: 0;
  }
  .preview {
    flex-direction: column;
    max-height: calc((100vw - 20px) * 9 / 16 + 214px - 5px);
    padding-bottom: 10px;
  }
  .container > .tabs {
    max-height: calc(100% - (100vw - 20px) * 9 / 16 - 214px + 5px);
  }
}
